import {reqCategoryList, reqBannerList, reqFloorList} from '@/api'

export default {
    namespaced: true,
    state : {
        navList:[],
        bannerList:[],
        floorList: [],
    },
    actions: {
        categorylist({commit}) {
            reqCategoryList().then((resp) => {
                commit('CATEGORYLIST', resp.data)
            },(err) => {
                console.log(err);
            });
        },
        getBannerList({commit}) {
            reqBannerList().then((resp) => {
                commit('GETBANNERLIST', resp.data)
            }, (err) => {
                console.log(err);
            })
        },
        getFloorList({commit}) {
            reqFloorList().then((req) => {
                commit('GETFLOORLIST', req.data);
            },(err) => {
                console.log(err);
            })
        }
        
    },
    mutations: {
        CATEGORYLIST(state, data) {
            state.navList.push(...data);
        },
        GETBANNERLIST(state, data) {
            state.bannerList = data;
        },
        GETFLOORLIST(state, data) {
         //   console.log(data);
            state.floorList = data;
        }
    }
}